[FSSDK-11095] rewrite condition_tree_evaluator tests in Typescript#994
Merged
esrakartalOpt merged 3 commits intomasterfrom Jan 29, 2025
Merged
Conversation
raju-opti
requested changes
Jan 29, 2025
Contributor
raju-opti
left a comment
There was a problem hiding this comment.
Looks good. Few minor change suggestions
| @@ -0,0 +1,230 @@ | |||
| /**************************************************************************** | |||
Contributor
There was a problem hiding this comment.
please use this copyright
/**
- Copyright 2025, Optimizely
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
- https://www.apache.org/licenses/LICENSE-2.0
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
*/
| value: 'CA', | ||
| }; | ||
|
|
||
| describe('lib/core/condition_tree_evaluator', function() { |
Contributor
There was a problem hiding this comment.
let's get rid of this and the next describe blocks, these are not necessary.
|
|
||
| it('should return the result of negating the first condition, and ignore any additional conditions', function() { | ||
| let result = conditionTreeEvaluator.evaluate(['not', '1', '2', '1'], function(id) { | ||
| return String(id) === '1'; |
Contributor
There was a problem hiding this comment.
instead of converting id to string here, maybe we can add (id: string) in the function signature?
| }); | ||
| expect(result).toBe(false); | ||
| result = conditionTreeEvaluator.evaluate(['not', '1', '2', '1'], function(id) { | ||
| return String(id) === '2'; |
| }); | ||
| expect(result).toBe(true); | ||
| result = conditionTreeEvaluator.evaluate(['not', '1', '2', '3'], function(id) { | ||
| return String(id) === '1' ? null : String(id) === '3'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
lib/core/condition_tree_evaluator/index.tests.jswith Typescriptmocha + sinon + chaitovitestPC: Didn't touch the old test case.
Issues